package com.example.day10_zuoye.fragmnet;


import android.os.Bundle;

import androidx.fragment.app.Fragment;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;

import com.example.day10_zuoye.R;
import com.example.day10_zuoye.bean.MusicBean;

import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;

/**
 * A simple {@link Fragment} subclass.
 */
public class FourFragment extends Fragment {


    public FourFragment() {
        // Required empty public constructor
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {

        EventBus.getDefault().register(this);

        return inflater.inflate(R.layout.fragment_four, container, false);
    }
    @Subscribe(threadMode = ThreadMode.MAIN,sticky = true)
    public void jieshou(MusicBean.ResultBean.SongsBean songsBean){
        Toast.makeText(getContext(), ""+songsBean.getName(), Toast.LENGTH_SHORT).show();

    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        EventBus.getDefault().unregister(this);
    }
}
